<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends CommonController {
	/**
	 * 后台首页
	 */
    public function index(){
		//$columns = D('Student')->column();
		//echo json_encode(array('zsc'=>'zsc','zsc1'=>'zsc1'));
		//echo 
		//$arr = json_decode($columns[7]['comment'],true);
		//print_r($arr);
		//print_r($columns[7]);
		//echo '<pre>';
		//print_r($columns);
		$this->display();
    }

	/**
	 * 修改 密码
	 */
	public function password() {
		if($_POST) {
			$admin = D('Admin');
			$checkmsg = $admin->checkform($_POST);
			if(!empty($checkmsg)) { // 表单验证
				$this->error($checkmsg);
			} else { // 表单处理
				$_POST['id'] = $_SESSION['admin']['id'];
				$msg = $admin->handleform($_POST);
				if(empty($msg)) {
					$this->error('操作失败！');
				} else {
					$this->error('操作成功！',U('Index/password'));
				}
			}
			die();
		}
		$columns = D('Admin')->column();
		$this->assign('input',$columns);
		$info = $_SESSION['admin'];
		$this->assign('info',$info);
		$this->display();
	}
}
